<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "dive_order".
 *
 * @property int $id id
 * @property int $uid uid
 * @property string $order_id 订单号
 * @property string $ctime 生成时间,毫秒
 * @property string $utime 更新时间,毫秒
 * @property int $order_status 订单状态
 * @property int $supply_status
 * @property int $payment_status
 * @property int $account_status
 * @property int $deleted 是否已删除 0否1是
 * @property int $trip_id 船期id
 * @property int $cabin_id 船舱id
 * @property int $one_self 是否独占
 * @property int occupancy_id 居住方式
 * @property string $room_ids 房型列表 ,分隔
 * @property string $contact 联系人 json
 * @property string $ext 附加信息
 * @property string $payment 支付信息
 * @property string $email
 * @property string $phone
 * @property int $fund_amount
 * @property string $use_protect
 * @property string $message
 * @property integer $price
 * @property integer $unitprice
 * @property float $exchange_rate
 */
class Order extends \yii\db\ActiveRecord
{
    public $first_name;
    public $last_name;
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'dive_order';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['uid', 'ctime', 'utime','cabin_id','one_self', 'order_status', 'supply_status', 'payment_status', 'account_status', 'deleted', 'trip_id', 'fund_amount','price','unitprice'], 'integer'],
            [['payment','cabin_id'], 'required'],
            [['ext', 'payment'], 'string'],
            [['order_id', 'email'], 'string', 'max' => 32],
            [['room_ids', 'use_protect'], 'string', 'max' => 255],
            [['contact', 'message'], 'string', 'max' => 2000],
            [['phone'], 'string', 'max' => 16],
            [['order_id'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'id',
            'uid' => 'uid',
            'order_id' => '订单号',
            'ctime' => '生成时间',
            'utime' => '更新时间',
            'order_status' => '订单',
            'supply_status' => '供应商',
            'payment_status' => '支付',
            'account_status' => '结算',
            'deleted' => '是否已删除',
            'trip_id' => '船期id',
            'room_ids' => '房型列表',
            'contact' => '联系人',
            'ext' => '附加信息',
            'payment' => '支付信息',
            'email' => 'Email',
            'phone' => '电话',
            'fund_amount' => '潜水基金',
            'use_protect' => 'Use Protect',
            'message' => '留言',
            'cabin_id'=>'船舱id','one_self'=>'独占','occupancy_id'=>'居住方式','price'=>'价格',
            'unitprice'=>'单价','exchange_rate'=>'汇率',
            'first_name'=>'First Name','last_name'=>'Last Name',
        ];
    }

    /**
     * @inheritdoc
     * @return OrderQuery the active query used by this AR class.
     */
    public static function find()
    {
        return new OrderQuery(get_called_class());
    }
}
